package com.controller.seedoctor;

import com.comm.R;
import com.comm.vo.PatientBankVo;
import com.comm.vo.PatientRecordsVo;
import com.comm.vo.RxVo;
import com.comm.vo.SaveVo;
import com.service.seedoctor.NewVisitsService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/seeDoctor/newVisits")
@Api(value = "新开就诊的所有操作功能",tags = "新开就诊的所有操作功能API接口")
@ApiResponses({
        @ApiResponse(code=200,message="请求成功"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=405,message="请求方法错误"),
        @ApiResponse(code=500,message="后台服务错误")
})
public class NewVisitsController {

    @Autowired
    private NewVisitsService newVisitsService;

    @ApiOperation(value = "根据患者姓名查询所有的挂号列表接口",notes = "根据姓名查询挂号列表",httpMethod = "get",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "bankName",value = "患者姓名",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "currentPage",value = "当前页",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页大小",paramType = "query",dataType = "int",required = true)
    })
    @ResponseBody
    @RequestMapping(value = "/selectRegisteredListByName",method = RequestMethod.GET)
    public R selectRegisteredListByName(String bankName,Integer currentPage,Integer pageSize){
        R r = newVisitsService.selectRegisteredListByName(bankName, currentPage ,pageSize);
        return r;
    }


    @ApiOperation(value = "根据挂号列表Id查询该患者的信息，档案，历史病历接口",notes = "根据挂号列表Id查询该患者的信息，档案，历史病历",httpMethod = "get",response = R.class)
    @ApiImplicitParam(name = "id",value = "挂号列表编号",paramType = "query",dataType = "Long",required = true)
    @ResponseBody
    @RequestMapping(value = "/selectPatientBankRecordsByRegId",method = RequestMethod.GET)
    public R selectPatientBankRecordsByRegId(Long id){
        R r = newVisitsService.selectPatientBankRecordsByRegId(id);
        return r;
    }


    @ApiOperation(value = "根据患者姓名查询所有患者库接口",notes = "根据姓名查询患者库",httpMethod = "get",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "bankName",value = "患者姓名",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "currentPage",value = "当前页",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页大小",paramType = "query",dataType = "int",required = true)
    })
    @ResponseBody
    @RequestMapping(value = "/selectPatientBankRecordsByBankName",method = RequestMethod.GET)
    public R selectPatientBankRecordsByBankName(String bankName,Integer currentPage,Integer pageSize){
        R r = newVisitsService.selectPatientBankByName(bankName, currentPage, pageSize);
        return r;
    }


    @ApiOperation(value = "根据患者库序号查询该患者的信息，档案，历史病历接口",notes = "根据患者库序号查询该患者的信息，档案，历史病历",httpMethod = "get",response = R.class)
    @ApiImplicitParam(name = "bankId",value = "患者库序号",paramType = "query",dataType = "int",required = true)
    @ResponseBody
    @RequestMapping(value = "/selectPatientBankRecordsById",method = RequestMethod.GET)
    public R selectPatientBankRecordsById(Long bankId){
        R r = newVisitsService.selectPatientBankRecordsById(bankId);
        return r;
    }


    @ApiOperation(value = "拿到就诊表的数据接口",notes = "拿到就诊表的数据，同时带有条件查询",httpMethod = "get",response = R.class)
    /*@ApiImplicitParams({
            @ApiImplicitParam(name = "keyWords",value = "后端根据这判断传来的是手机号还是姓名",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "status",value = "交易状态 0未交费 1已交费 2已经完成交易 3已退款 4分步退款 5全部按钮状态为",paramType = "query",dataType = "int",required = false)
    })*/
    @ResponseBody
    @RequestMapping(value = "/history",method = RequestMethod.GET)
    public R history(){
      R r= newVisitsService.selectAllSeeDoctor();
      return r;
    }


    @ApiOperation(value = "获取历史信息接口",notes = "拿到患者部分，病历部分，处方部分，处方默认展示的最近一次病历的处方",httpMethod = "get",response = R.class)
    @ApiImplicitParam(name = "seeDoctorId",value = "诊断表的id",paramType = "query",dataType = "int",required = true)
    @ResponseBody
    @RequestMapping(value = "/getInfoById",method = RequestMethod.GET)
    public String getInfoById(Integer seeDoctorId){
        return "{\n" +
                "  \"code\": 200,\n" +
                "  \"msg\": \"查询成功！\",\n" +
                "  \"data\": [\n" +
                "    {\n" +
                "      \"patientBank\": {\n" +
                "        \"bankId\": 1001011,\n" +
                "        \"bankName\": \"于和伟\",\n" +
                "        \"updateTime\": \"2002-11-1\",\n" +
                "        \"sex\": \"男\",\n" +
                "        \"age\": 18,\n" +
                "        \"idNumber\": 7827836782673123,\n" +
                "        \"phone\": 18187879878,\n" +
                "        \"rightVision\": \"四川成都成都成都\",\n" +
                "        \"birthday\": \"1999-1-1\",\n" +
                "        \"allergicHistory\": \"该人无过敏史哦！\",\n" +
                "        \"patient\": {\n" +
                "          \"patientId\": 1288128,\n" +
                "          \"height\": 170.0,\n" +
                "          \"weight\": 120,\n" +
                "          \"leftEar\": 3.0,\n" +
                "          \"rightEar\": 5.0,\n" +
                "          \"leftVision\": 5.0,\n" +
                "          \"rightVision\": 5.0,\n" +
                "          \"phone\": \"19191991911\",\n" +
                "          \"familyHistory\": \"家族史加速中1111111111111.。\",\n" +
                "          \"personalHistory\":\"。。。。。。。。。。。。。个人史\"\n" +
                "        }\n" +
                "      },\n" +
                "      \"patientRecords\":[{\n" +
                "        \"recordsId\": 7788,\n" +
                "        \"recordsTime\": \"2001-11-1\",\n" +
                "        \"recordsType\": \"急诊\",\n" +
                "        \"infect\": \"否\",\n" +
                "        \"message\": \"诊断信息为！！！\",\n" +
                "        \"mainSuit\": \"。。。。。。。。。。。。。。。主诉\",\n" +
                "        \"docterSuggest\": \"医生建议、。。。。、、、多喝热水！！！\",\n" +
                "        \"hospital\": \"顺风医院！\"\n" +
                "      },{\n" +
                "        \"recordsId\": 7788,\n" +
                "        \"recordsTime\": \"2001-11-1\",\n" +
                "        \"recordsType\": \"急诊\",\n" +
                "        \"infect\": \"否\",\n" +
                "        \"message\": \"诊断信息为！！！\",\n" +
                "        \"mainSuit\": \"。。。。。。。。。。。。。。。主诉\",\n" +
                "        \"docterSuggest\": \"医生建议、。。。。、、、多喝热水！！！\",\n" +
                "        \"hospital\": \"顺风医院！\"\n" +
                "      },{\n" +
                "        \"recordsId\": 7788,\n" +
                "        \"recordsTime\": \"2001-11-1\",\n" +
                "        \"recordsType\": \"急诊\",\n" +
                "        \"infect\": \"否\",\n" +
                "        \"message\": \"诊断信息为！！！\",\n" +
                "        \"mainSuit\": \"。。。。。。。。。。。。。。。主诉\",\n" +
                "        \"docterSuggest\": \"医生建议、。。。。、、、多喝热水！！！\",\n" +
                "        \"hospital\": \"顺风医院！\"\n" +
                "      }],\n" +
                "      \"rx\": [{\n" +
                "        \"rxId\": 10011,\n" +
                "        \"rxName\": \"处方1\",\n" +
                "        \"drugName\": \"芍药\",\n" +
                "        \"drugNumber\": 1,\n" +
                "        \"price\": 10,\n" +
                "        \"amount\": 10,\n" +
                "        \"remarks\": \"中药还吗，，咯扑克牌哦\",\n" +
                "        \"medicationRequirements\": \"服药要求！！！！！！\",\n" +
                "        \"rxType\": \"中药\"\n" +
                "    },\n" +
                "        {\n" +
                "          \"rxId\": 10012,\n" +
                "          \"rxName\": \"处方1\",\n" +
                "          \"drugName\": \"草药\",\n" +
                "          \"drugNumber\": 1,\n" +
                "          \"price\": 20,\n" +
                "          \"amount\": 20,\n" +
                "          \"remarks\": \"中药还吗，，咯扑克牌哦\",\n" +
                "          \"medicationRequirements\": \"服药要求！！！！！！\",\n" +
                "          \"rxType\": \"中药\"\n" +
                "        },{\n" +
                "          \"rxId\": 10013,\n" +
                "          \"rxName\": \"处方2\",\n" +
                "          \"drugName\": \"ct\",\n" +
                "          \"drugNumber\": 1,\n" +
                "          \"price\": 100,\n" +
                "          \"amount\": 100,\n" +
                "          \"remarks\": \"拍片\",\n" +
                "          \"medicationRequirements\": \"服药要求！！！！！！\",\n" +
                "          \"rxType\": \"拍片类\"\n" +
                "        }]\n" +
                "    }\n" +
                "  ]\n" +
                "}\n";
    }


    @ApiOperation(value = "根据药品名称查询中药库存接口",notes = "根据药品名称查询中药库存",httpMethod = "get",response = R.class)
    @ApiImplicitParam(name = "drugName",value = "中药名称",paramType = "query",dataType = "String",required = false)
    @ResponseBody
    @RequestMapping(value = "/selectDrugAllListByName",method = RequestMethod.GET)
    public R selectDrugAllListByName(String drugName){
        R r = newVisitsService.selectDrugAllByName(drugName);
        return r;
    }


    @ApiOperation(value = "根据项目名称查询所有检擦项目接口",notes = "根据项目名称查询所有检擦项目",httpMethod = "get",response = R.class)
    @ApiImplicitParam(name = "itemName",value = "检查项目名称",paramType = "query",dataType = "String",required = false)
    @ResponseBody
    @RequestMapping(value = "/selectInsItemListByName",method = RequestMethod.GET)
    public R selectInsItemListByName(String itemName){
        R r = newVisitsService.selectInspectionItemByName(itemName);
        return r;
    }


    @ApiOperation(value = "查询所有处方附加费用接口",notes = "查询所有处方附加费用",httpMethod = "get",response = R.class)
    @ResponseBody
    @RequestMapping(value = "/selectPreCostListByCostName",method = RequestMethod.GET)
    public R selectPreCostListByCostName(){
        R r = newVisitsService.selectPreCostListByCostName();
        return r;
    }


    @ApiOperation(value = "保存按钮接口",notes = "提交或修改各个表",httpMethod = "post", response = R.class)
    @ResponseBody
    @RequestMapping(value = "/saveAll",method = RequestMethod.POST)
    public String saveAll(@RequestBody @ApiParam(name = "save",value = "保存所提的实体实体",required = true) SaveVo saveVo){
        return "{\n" +
                "\t\"code\": 200,\n" +
                "\t\"msg\": \"查询成功！\",\n" +
                "\t\"data\": [null]\n" +
                "}";
    }
}
